﻿using System;
using System.Globalization;

namespace POS.USBScanner
{
    public enum BarcodeScannerDeviceType : int
    {
        Unknown = 0,
        Keyboard = 1,
        HumanInterfaceDevice = 2
    }

    public class BarcodeScannerDeviceInfo
    {
        public BarcodeScannerDeviceInfo(
            string deviceName,
            BarcodeScannerDeviceType deviceType,
            IntPtr deviceHandle,
            string friendlyName)
        {
            this.DeviceName = deviceName;
            this.DeviceType = deviceType;
            this.DeviceHandle = deviceHandle;
            this.FriendlyName = friendlyName;
        }

        public string DeviceName { get; private set; }

        public BarcodeScannerDeviceType DeviceType { get; private set; }

        public IntPtr DeviceHandle { get; private set; }

        public string FriendlyName { get; private set; }

        public override string ToString()
        {
            return string.Format(
                CultureInfo.InvariantCulture,
                "{0} ({1}; handle: {2}; type: {3})",
                GetType().Name,
                this.FriendlyName,
                this.DeviceHandle,
                this.DeviceType);
        }
    }
}
